package test;

public class ExceptionDemo02 {
    public static void main(String[] args) {
        System.out.println(test(null)+","+test("0")+","+test(""));
    }
    public static int test(String str){
        try{
            return str.charAt(0)-'0';
        }catch (NullPointerException e){
            e.printStackTrace();
            System.out.println("a");
            return 1;
        }catch(RuntimeException e){
            e.printStackTrace();
            System.out.println("b");
            return 2;
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("c");
            return 3;
        }finally {
            System.out.println("d");
            return 4;
        }
    }
}
